using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Configuration;
using System.Globalization;
using MSRI.HelperClasses;
using Instedd.Labs.Geo.Library.Sms;
using Instedd.Labs.Geo.Library.Kml;

namespace Instedd.Sms.Client
{
    public partial class SendSMSForm : Form
    {
        private string defaultReceiverNumber = ConfigurationManager.AppSettings["defaultReceiverNumber"];
        private string smsServiceName = ConfigurationManager.AppSettings["smsServiceName"];

        public SendSMSForm()
        {
            InitializeComponent();

            this.textBoxNumber.Text = defaultReceiverNumber;

            //LatLong location = SmsManager.GetManager().GPS.GetLocation();
            //this.textBoxLat.Text = location.Lat.ToString(CultureInfo.InvariantCulture);
            //this.textBoxLong.Text = location.Long.ToString(CultureInfo.InvariantCulture);

            SmsManager.Start(smsServiceName, SmsManagerType.SendOnlyManager);
        }

        private void buttonSend_Click(object sender, EventArgs e)
        {
            SmsClass sms = new SmsClass(this.textBoxNumber.Text, string.Format("{0}*{1}*{2}", this.textBoxLat.Text, this.textBoxLong.Text, this.textBoxMessage.Text));
            SmsManager.GetManager().Service.SendSms(sms);
        }
    }
}